﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using KPIS.GERP.GHRMS.BLL;
using KPIS.GERP.GHRMS.IBLL;
using KPIS.GERP.GHRMS.MODEL;
using System.Globalization;

namespace KPIS.GERP.GHRMS.APP.App_UI.UserControls
{
    public partial class RC_MoveOfficialPlus : System.Web.UI.UserControl
    {

        private object _dataItem = null;

        protected bool IsUserControlPostBack
        {
            get
            {
                return this.ViewState["IsUserControlPostBack"] != null;
            }
        }



        public string formatDateThai(string value)
        {

            //08/04/2553

            int pos = value.IndexOf("0:00:00");
            if (pos > 1)
            {
                value = value.Replace("00:00:00", "");
                value = value.Replace("0:00:00", "");
            }


            string tmp = null;
            string[] tmp2 = null;
            tmp2 = value.Split('/');
            tmp = tmp2[1] + "/" + tmp2[0] + "/" + Convert.ToString(int.Parse(tmp2[2]));

            return tmp;
        }




        protected override void OnLoad(System.EventArgs e)
        {
            base.OnLoad(e);

            if (!IsUserControlPostBack)
            {


  
                bindMovmentCombo();

                bindPosTypeCombo();
                bindClasscombo();
                bindJobSiteCombo();

                bindOldClasscombo();                
                bindOldPosTypeCombo();

                bindEntPosTypeCombo();
                bindEntClasscombo();

                this.ViewState.Add("IsUserControlPostBack", true);

            }

            if (DataItem != null)
            {
                

                if (!(DataItem is Telerik.Web.UI.GridInsertionObject))
                {



                    bindMovmentCombo();

                    bindPosTypeCombo();
                    bindClasscombo();
                    bindJobSiteCombo();

                    bindOldClasscombo();
                    bindOldPosTypeCombo();


                    bindEntPosTypeCombo();
                    bindEntClasscombo();

                    btnFindTempEmployee.Visible = false;

                    lblCmdDtlsSEq.Text = DataBinder.Eval(DataItem, "cmd_dtls_seq").ToString();
                    lblEmpSeq.Text = DataBinder.Eval(DataItem, "emp_seq").ToString();

                    RC_TransferBLL obj = new RC_TransferBLL();
                    DataTable dt;
                    dt = obj.SelectTmpEmpByID(int.Parse(lblEmpSeq.Text));
                    
                    //// ชื่อ  สกุล  //////
                    txttempEmployee.Text = dt.Rows[0]["full_name"].ToString();
                 
                    movmentCombo.SelectedValue = DataBinder.Eval(DataItem, "move_seq").ToString();


                    /////////////////




                    //  วุฒิการศึกษา //////////
                    BindComboTmpEdu();
                    ComboTmpEdu.SelectedValue = DataBinder.Eval(DataItem, "edu_his_seq").ToString();
                    int edu_qual_seq = int.Parse(ComboTmpEdu.SelectedValue);

                    RC_PromoteOfficialBLL obj2 = new RC_PromoteOfficialBLL();
                    dt = obj2.BindTxtMajor(edu_qual_seq);

                    lblMajor.Text = dt.Rows[0]["edu_major_name"].ToString();
                    lblInstitutes.Text = dt.Rows[0]["edu_ins_name"].ToString();   

                    ////////////////////////


                   txttempEmployee.Text =   DataBinder.Eval(DataItem, "full_name").ToString();    

                    // วุฒิการศึกษา

                 //  ComboTmpEdu.SelectedValue = DataBinder.Eval(DataItem, "tmp_edu_seq").ToString();    


                    //ตำแหน่งและส่วนราชการเดิม
                   //old_pos_name = txtOldPosition.Text;
                   //old_pos_type_seq = int.Parse(oldPosTypeCombo.SelectedValue);
                   //old_class_seq = int.Parse(oldClassCombo.SelectedValue);
                   //old_job_site_name = txtOldJobsiteName.Text;
                   //old_salary = Convert.ToDouble(txtOldSalary.Text);
                   //salary = Convert.ToDouble(txtSalary.Text);    

                   txtOldPosition.Text = DataBinder.Eval(DataItem, "old_pos_name").ToString();

                   oldPosTypeCombo.SelectedValue = DataBinder.Eval(DataItem, "old_pos_type_seq").ToString();
                   oldClassCombo.SelectedValue = DataBinder.Eval(DataItem, "old_class_seq").ToString();
                   txtOldJobsiteName.Text = DataBinder.Eval(DataItem, "old_job_site_name").ToString();
                   txtOldSalary.Text = DataBinder.Eval(DataItem, "old_salary").ToString();   


                    //ตำแหน่งที่สอบแข่งขันได้

                     txtEntPosition.Text = DataBinder.Eval(DataItem, "ent_pos_name").ToString();
                     entPostTypeCombo.SelectedValue = DataBinder.Eval(DataItem, "ent_pos_type_seq").ToString();
                     entClassCombo.SelectedValue = DataBinder.Eval(DataItem, "ent_class_seq").ToString();
                     txtEntNo.Text = DataBinder.Eval(DataItem, "ent_no").ToString();
                 //  ent_date = txtEntDate.GetStringValue();


                     txtEntJobSiteName.Text = DataBinder.Eval(DataItem, "ent_job_site_name ").ToString();

                     string entDate;
                     entDate = ((DateTime)DataBinder.Eval(DataItem, "ent_date")).ToString("dd/MM/yyyy", new CultureInfo("th-TH"));
                    // entDate = formatDateThai(entDate);

                     txtEntDate.SetValue(entDate);  



                    //ตำแหน่งและส่วนราชการที่รับโอน

                   string strDate;
                   txtPosition.Text = DataBinder.Eval(DataItem, "new_pos_name").ToString();
                   txtPosRef.Text = DataBinder.Eval(DataItem, "new_pos_ref").ToString();
             
               posTypeCombo.SelectedValue = DataBinder.Eval(DataItem, "new_pos_type_seq").ToString();
               classCombo.SelectedValue = DataBinder.Eval(DataItem, "new_class_seq").ToString();
                   jobSiteCombo.SelectedValue = DataBinder.Eval(DataItem, "new_job_site_seq").ToString();
                   txtSalary.Text = DataBinder.Eval(DataItem, "new_salary").ToString();

                   txtRemarks.Text = DataBinder.Eval(DataItem, "remarks").ToString();
                    strDate = DataBinder.Eval(DataItem, "start_date").ToString();
                    strDate = formatDateThai(strDate);
                    txtStartDate.SetValue(strDate);  
                }


                btnUpdate.Visible = !(DataItem is Telerik.Web.UI.GridInsertionObject);
                btnAddnew.Visible = (DataItem is Telerik.Web.UI.GridInsertionObject);
            }


        }

        private void bindClasscombo()
        {

            DataTable dt;
            MoveCommandBLL obj = new MoveCommandBLL();

            dt = obj.SelectClasscombo();

            classCombo.DataValueField = "class_seq";
            classCombo.DataTextField = "class_name";
            classCombo.DataSource = dt;
            classCombo.DataBind();
        }

        private void bindOldClasscombo()
        {

            DataTable dt;
            MoveCommandBLL obj = new MoveCommandBLL();

            dt = obj.SelectClasscombo();

            oldClassCombo.DataValueField = "class_seq";
            oldClassCombo.DataTextField = "class_name";
            oldClassCombo.DataSource = dt;
            oldClassCombo.DataBind();
        }

        private void bindEntClasscombo()
        {

            DataTable dt;
            MoveCommandBLL obj = new MoveCommandBLL();

            dt = obj.SelectClasscombo();

            entClassCombo.DataValueField = "class_seq";
            entClassCombo.DataTextField = "class_name";
            entClassCombo.DataSource = dt;
            entClassCombo.DataBind();
        }

        private void bindJobSiteCombo()
        {
            DataTable dt;
            MoveCommandBLL obj = new MoveCommandBLL();

            dt = obj.SelecteJobsiteCombo();
            jobSiteCombo.DataValueField = "job_site_seq";
            jobSiteCombo.DataTextField = "job_site_name";
            jobSiteCombo.DataSource = dt;
            jobSiteCombo.DataBind();
        }
                
        private void bindMovmentCombo()
        {
            DataTable dt;
            MoveCommandBLL obj = new MoveCommandBLL();

            dt = obj.SelectMovmentCombo();

            movmentCombo.DataValueField = "move_seq";
            movmentCombo.DataTextField = "move_name";
            movmentCombo.DataSource = dt;
            movmentCombo.DataBind();
        }
        
        private void bindOldPosTypeCombo()
        {
            DataTable dt;
            MoveCommandBLL obj = new MoveCommandBLL();

            dt = obj.SelectePosTypeCombo();

            oldPosTypeCombo.DataValueField = "pos_type_seq";
            oldPosTypeCombo.DataTextField = "pos_type_name";
            oldPosTypeCombo.DataSource = dt;
            oldPosTypeCombo.DataBind();
        }


        private void bindEntPosTypeCombo()
        {
            DataTable dt;
            MoveCommandBLL obj = new MoveCommandBLL();

            dt = obj.SelectePosTypeCombo();


            entPostTypeCombo.DataValueField = "pos_type_seq";
            entPostTypeCombo.DataTextField = "pos_type_name";
            entPostTypeCombo.DataSource = dt;
            entPostTypeCombo.DataBind();
        }





        private void bindPosTypeCombo()
        {
            DataTable dt;
            MoveCommandBLL obj = new MoveCommandBLL();

            dt = obj.SelectePosTypeCombo();

            posTypeCombo.DataValueField = "pos_type_seq";
            posTypeCombo.DataTextField = "pos_type_name";
            posTypeCombo.DataSource = dt;
            posTypeCombo.DataBind();
        }


        public object DataItem
        {
            get
            {
                return this._dataItem;
            }
            set
            {
                this._dataItem = value;
            }
        }

        protected void btnAddnew_Click(object sender, EventArgs e)
        {

string  start_date;//ตั้งแต่วันที่
int cmd_seq,emp_seq,new_pos_seq;//รหัสคำสั่ง,รหัส tmp บุคลากร,รหัสตำแหน่ง
string new_pos_ref,new_pos_name;//เลขที่ตำแหน่ง,ชื่อตำแหน่ง
int new_class_seq,new_job_site_seq;//รหัสระดับ,รหัสหน่วยงาน
string new_job_site_name;//ชื่อหน่วยงาน

int edu_his_seq;// seq วุฒิการศึกษาที่บรรจุ
string ent_pos_name;//สอบแข่งขันได้ลำดับที่,ตำแหน่งที่สอบแข่งขันได้
int ent_pos_type_seq, ent_class_seq;//ประภทตำแหน่งที่สอบแข่งขันได้,ระดับตำแหน่งที่สอบแข่งขันได้
string ent_job_site_name,ent_date;//ตามประกาศผลสอบของ,ลงวันที่
int ent_no;
int old_pos_type_seq,old_class_seq; //ประเภทตำแหน่งเดิม,ระดับตำแหน่งเดิม
string old_job_site_name, old_pos_name;//สังกัดเดิม,ตำแหน่งเดิม
double old_salary,salary; //เงินเดือนเดิม ,เงินเดือน
string new_class_name;
            
int move_seq,new_pos_type_seq;//ประเภทการเคลื่อนไหว,ตำแหน่งประเภท
string remarks;//หมายเหตุ
int created_by;

cmd_seq = int.Parse(Session["cmd_seq"].ToString() );  
move_seq = int.Parse(movmentCombo.SelectedValue);  

// วุฒิการศึกษา
edu_his_seq = int.Parse(ComboTmpEdu.SelectedValue);   


// ตำแหน่งและส่วนราชการเดิม

old_pos_name = txtOldPosition.Text;
old_pos_type_seq = int.Parse(oldPosTypeCombo.SelectedValue);
old_class_seq = int.Parse(oldClassCombo.SelectedValue);
old_job_site_name = txtOldJobsiteName.Text;
old_salary = Convert.ToDouble(txtOldSalary.Text);
salary = Convert.ToDouble(txtSalary.Text);    
            

            // ตำแหน่งที่สอบแข่งขันได้


ent_pos_name = txtEntPosition.Text;
ent_pos_type_seq = int.Parse(entPostTypeCombo.SelectedValue);
ent_class_seq = int.Parse(entClassCombo.SelectedValue);
ent_no = int.Parse(txtEntNo.Text);
ent_date = txtEntDate.GetStringValue();
ent_job_site_name = txtEntJobSiteName.Text;    

//ตำแหน่งและส่วนราชการที่รับโอน 

new_pos_name = txtPosition.Text;
new_pos_ref = txtPosRef.Text;
new_class_name = classCombo.Text;          
new_class_seq = int.Parse(classCombo.SelectedValue);
new_job_site_seq = int.Parse(jobSiteCombo.SelectedValue);
new_job_site_name = jobSiteCombo.Text;
start_date = txtStartDate.GetStringValue();
remarks = txtRemarks.Text;
new_pos_type_seq = int.Parse(posTypeCombo.SelectedValue);



RC_MoveOfficialPlusBLL obj = new RC_MoveOfficialPlusBLL();

obj.insert(cmd_seq, int.Parse(lblEmpSeq.Text), move_seq,edu_his_seq, 
    old_pos_name, old_pos_type_seq, old_class_seq
    , old_job_site_name, old_salary, salary, new_pos_name, new_pos_ref, 
    new_class_seq, new_job_site_seq, new_job_site_name, start_date,new_pos_type_seq, 
    remarks, 1,ent_pos_name,ent_pos_type_seq,ent_class_seq,ent_no,ent_date,ent_job_site_name,new_class_name);              



        }

        protected void btnCancel_Click(object sender, EventArgs e)
        {

        }

        protected void btnUpdate_Click(object sender, EventArgs e)
        {

            string start_date;//ตั้งแต่วันที่
            int cmd_seq, tmp_emp_seq, emp_seq, pos_seq;//รหัสคำสั่ง,รหัส tmp บุคลากร,รหัสตำแหน่ง
            string pos_ref_no, pos_name;//เลขที่ตำแหน่ง,ชื่อตำแหน่ง
            int class_seq, job_site_seq;//รหัสระดับ,รหัสหน่วยงาน
            string job_site_name;//ชื่อหน่วยงาน

            int edu_his_seq;// seq วุฒิการศึกษาที่บรรจุ
            string  ent_pos_name;//สอบแข่งขันได้ลำดับที่,ตำแหน่งที่สอบแข่งขันได้
            int ent_pos_type_seq, ent_class_seq;//ประภทตำแหน่งที่สอบแข่งขันได้,ระดับตำแหน่งที่สอบแข่งขันได้
            string ent_job_site_name, ent_date;//ตามประกาศผลสอบของ,ลงวันที่
            int ent_no;
            int old_pos_type_seq, old_class_seq; //ประเภทตำแหน่งเดิม,ระดับตำแหน่งเดิม
            string old_job_site_name, old_pos_name;//สังกัดเดิม,ตำแหน่งเดิม
            double old_salary, salary; //เงินเดือนเดิม ,เงินเดือน

            int move_seq, pos_type_seq;//ประเภทการเคลื่อนไหว,ตำแหน่งประเภท
            string remarks;//หมายเหตุ
            int created_by;


            cmd_seq = 1;
            move_seq = int.Parse(movmentCombo.SelectedValue);

            // วุฒิการศึกษา
            edu_his_seq = int.Parse(ComboTmpEdu.SelectedValue);


            // ตำแหน่งและส่วนราชการเดิม

            old_pos_name = txtOldPosition.Text;
            old_pos_type_seq = int.Parse(oldPosTypeCombo.SelectedValue);
            old_class_seq = int.Parse(oldClassCombo.SelectedValue);
            old_job_site_name = txtOldJobsiteName.Text;
            old_salary = Convert.ToDouble(txtOldSalary.Text);
            salary = Convert.ToDouble(txtSalary.Text);

            // ตำแหน่งที่สอบแข่งขันได้


            ent_pos_name = txtEntPosition.Text;
            ent_pos_type_seq = int.Parse(entPostTypeCombo.SelectedValue);
            ent_class_seq = int.Parse(entClassCombo.SelectedValue);
            ent_no = int.Parse(txtEntNo.Text);
            ent_date = txtEntDate.GetStringValue();
            ent_job_site_name = txtEntJobSiteName.Text;   


            //ตำแหน่งและส่วนราชการที่รับโอน 
            string new_class_name;
            pos_name = txtPosition.Text;
            pos_ref_no = txtPosRef.Text;
            class_seq = int.Parse(classCombo.SelectedValue);
            job_site_seq = int.Parse(jobSiteCombo.SelectedValue);
            job_site_name = jobSiteCombo.Text;
            start_date = txtStartDate.GetStringValue();
            remarks = txtRemarks.Text;
            pos_type_seq = int.Parse(posTypeCombo.SelectedValue);
            new_class_name = classCombo.Text;  

            RC_MoveOfficialPlusBLL obj = new RC_MoveOfficialPlusBLL();
            obj.Update(int.Parse(lblCmdDtlsSEq.Text),move_seq, edu_his_seq,old_pos_name, old_pos_type_seq, old_class_seq,
                old_job_site_name,old_salary, salary, pos_name, pos_ref_no, class_seq, job_site_seq, job_site_name, start_date,
                pos_type_seq,remarks, 1,ent_pos_name,ent_pos_type_seq,ent_class_seq,ent_no,ent_date,ent_job_site_name,new_class_name );  
        
        


        }

        protected void movmentCombo_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
        {

        }

        protected void oldPosTypeCombo_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
        {

        }

        protected void posTypeCombo_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
        {

        }

        protected void jobSiteCombo_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
        {

        }

        protected void classCombo_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
        {

        }
       
        protected void txtSalary_TextChanged(object sender, EventArgs e)
        {

        }

        protected void txtStartDate_TextChanged(object sender, EventArgs e)
        {

        }

        protected void txtOldJobsiteName_TextChanged(object sender, EventArgs e)
        {

        }

        protected void txtOldPosition_TextChanged(object sender, EventArgs e)
        {

        }

        protected void txtOldSalary_TextChanged(object sender, EventArgs e)
        {

        }

        protected void btnFindTempEmployee_Load(object sender, EventArgs e)
        {
            if (DataItem is Telerik.Web.UI.GridInsertionObject)
            {
                btnFindTempEmployee.Attributes.Add("OnClick", "LinkMDdetail(" + HideEmployee.ClientID + "," + "'Forms/DialogRC_Emp.aspx','../frmIframe.html',700,500)");
            }



        }

        protected void oldClassCombo_SelectedIndexChanged1(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
        {

        }

   
        private EmployeeInfo empInfo;
        private IEmployeeBLL empBLL = new EmployeeBLL();

        protected void btnFindTempEmployee_Click1(object sender, ImageClickEventArgs e)
        {

            txttempEmployee.Text = "";
          


            string st = HideEmployee.Value;
            if (st == "")
                return;


            lblEmpSeq.Text = st; 
            

            IList<EmployeeInfo> empList = empBLL.ListEmployees(st.ToString());

            if (empList.Count > 0)
            {

                empInfo = empList[0];
                RC_PromoteOfficialBLL obj = new RC_PromoteOfficialBLL();

                int cmd_seq = int.Parse(Session["cmd_seq"].ToString());
                if (obj.chkDup(cmd_seq, int.Parse(st)) == true)
                {
                    lblWarningDup.Visible = true;
                    lblWarningDup.Text = "มีรายชื่อนี้อยู่ในระบบแล้ว";
                    return;

                }
                else
                {
                    lblWarningDup.Visible = false;

                }

                DataTable dt;
                dt = obj.SelectEmpByID(int.Parse(st));
                txttempEmployee.Text = dt.Rows[0]["full_name"].ToString();
           
                BindComboTmpEdu();



                txtOldJobsiteName.Text = empInfo.WorkingJobSite.Name;
                txtOldPosition.Text = empInfo.Position.Name;
                txtOldSalary.Text = empInfo.Salary.ToString();
                //txtOldPosRef.Text = empInfo.Position.RefNo;

                oldClassCombo.SelectedValue = empInfo.Class.Sequence.ToString();
                oldPosTypeCombo.SelectedValue = empInfo.Position.PositionType.Sequence.ToString();

            }
        }


        private void BindComboTmpEdu()
        {
            DataTable dt;
            RC_BackOfficialBLL obj = new RC_BackOfficialBLL();
        
            dt = obj.SelectComboEdu (int.Parse(lblEmpSeq.Text));

            ComboTmpEdu.DataValueField = "edu_qual_seq";
            ComboTmpEdu.DataTextField = "edu_qual_name";
            ComboTmpEdu.DataSource = dt;
            ComboTmpEdu.DataBind();  
                


        }

        protected void ComboTmpEdu_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
        {
            int edu_qual_seq;
            edu_qual_seq = int.Parse(ComboTmpEdu.SelectedValue);
            DataTable dt;
            RC_PromoteOfficialBLL obj = new RC_PromoteOfficialBLL();

            dt = obj.BindTxtMajor(edu_qual_seq);
            if (dt.Rows.Count > 0)
            {
                lblMajor.Text = dt.Rows[0]["edu_major_name"].ToString();
                lblInstitutes.Text = dt.Rows[0]["edu_ins_name"].ToString();
            }

        }

        protected void txtOldPosition_TextChanged1(object sender, EventArgs e)
        {

        }

     
        protected void DetailPanel_Load(object sender, EventArgs e)
        {

        }

        protected void btnFindOldPos_Click(object sender, ImageClickEventArgs e)
        {


            string st = HideOldPos.Value;
            if (st == "")
                return;

            //   txtOldPosition.Text = st;

            RC_TransferBLL obj = new RC_TransferBLL();
            DataTable dt;
            dt = obj.BindPositionType(int.Parse(st));

            string idx;
            idx = dt.Rows[0]["pos_type_seq"].ToString();

            oldPosTypeCombo.SelectedValue = idx;

            txtOldPosition.Text = dt.Rows[0]["field_pos_line"].ToString();



        }

        protected void btnFindOldPos_Load(object sender, EventArgs e)
        {

            //if (DataItem is Telerik.Web.UI.GridInsertionObject)
            //{
                btnFindOldPos.Attributes.Add("OnClick", "LinkMDdetail(" + HideOldPos.ClientID + "," + "'Forms/DialogRC_OldPos.aspx','../frmIframe.html',700,500)");
            //}


        }

        protected void btnFindPos_Click(object sender, ImageClickEventArgs e)
        {

            string st = HideOldPos.Value;
            if (st == "")
                return;


            RC_TransferBLL obj = new RC_TransferBLL();

            DataTable dt;


            dt = obj.BindPosition(int.Parse(st));
 
   
            if(dt.Rows.Count > 0) 
            {

                

                txtPosition.Text = dt.Rows[0]["pos_name"].ToString();
                txtPosRef.Text = dt.Rows[0]["pos_ref"].ToString();
                posTypeCombo.SelectedValue = dt.Rows[0]["pos_type_seq"].ToString();
                jobSiteCombo.SelectedValue = dt.Rows[0]["job_site_seq"].ToString(); 
                 
            }


        }

        protected void btnFindPos_Load(object sender, EventArgs e)
        {

            //if (DataItem is Telerik.Web.UI.GridInsertionObject)
            //{
                btnFindPos.Attributes.Add("OnClick", "LinkMDdetail(" + HideOldPos.ClientID + "," + "'Forms/DialogRC_Pos.aspx','../frmIframe.html',700,500)");
            //}


        }

        protected void txtEntPosition_TextChanged(object sender, EventArgs e)
        {



        }

        protected void entClassCombo_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
        {


        }

        protected void txtEntJobSiteName_TextChanged(object sender, EventArgs e)
        {

        }

        protected void entPostTypeCombo_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
        {

        }

        protected void txtEntNo_TextChanged(object sender, EventArgs e)
        {

        }

        protected void txtEntDate_TextChanged(object sender, EventArgs e)
        {

        }

        protected void btnFindEntPos_Click(object sender, ImageClickEventArgs e)
        {

            string st = HideEntPos.Value;
            if (st == "")
                return;


            RC_TransferExamBLL obj = new RC_TransferExamBLL();

            DataTable dt;


            dt = obj.BindPosition(int.Parse(st));


            if (dt.Rows.Count > 0)
            {


               
                txtEntPosition.Text = dt.Rows[0]["pos_name"].ToString();
               // txtPosRef.Text = dt.Rows[0]["pos_ref"].ToString();
                entPostTypeCombo.SelectedValue = dt.Rows[0]["pos_type_seq"].ToString();
               // jobSiteCombo.SelectedValue = dt.Rows[0]["job_site_seq"].ToString();
            }
            }

        protected void btnFindEntPos_Load(object sender, EventArgs e)
        {

            btnFindEntPos.Attributes.Add("OnClick", "LinkMDdetail(" + HideEntPos.ClientID + "," + "'Forms/DialogRC_OldPos.aspx','../frmIframe.html',700,500)");
        }

        protected void entPostTypeCombo_TextChanged(object sender, EventArgs e)
        {


        }

        }

     

    
  

         


    }    
    
